Image processing method and device, computer-readable storage medium and computer device

ABSTRACT

An image processing method is provided. The image processing method includes: each frame of image in multiple continuous frames of images is processed to determine a number of light sources of each frame of image; it is determined whether a difference between a number of light sources of a kth frame of image and a number of light sources of a (k+1)th frame of image is equal to 0; and when the difference is unequal to 0, a color temperature of the (k+1)th frame of image is determined to be a color temperature of the kth frame of image and the (k+1)th frame of image is processed according to the color temperature of the (k+1)th frame of image. An image processing device, a computer-readable storage medium and a computer device are further provided.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a continuation application of U.S. patent application Ser. No.16/151,146 filed on Oct. 3, 2018, which claims priority to ChinesePatent Application 201711420294.3, filed on Dec. 25, 2017, the contentsof which are hereby incorporated by reference in their entireties.

BACKGROUND

The disclosure relates to the technical field of image processing, andparticularly to an image processing method, an image processing device,a computer-readable storage medium and a computer device.

According to an image method in the related art, a preview image isprocessed to detect a light source and white balance processing isperformed according to a color of the light source. However, when a lensshakes, a field of view may jump to change a distribution of the lightsource in the preview image and further cause a tone of the previewimage subjected to white balance correction to jump. For example,shaking of the lens makes the light source or part of the light sourcein and out randomly, destabilizes a white balance processing effect andaffects a user experience.

SUMMARY

Embodiments of the disclosure provide an image processing method, animage processing device, a computer device and a computer-readablestorage medium.

According to a first aspect, the embodiments of the disclosure providean image processing method, which may include the following operations.Each frame of image in multiple continuous frames of images is processedto determine the number of light sources of each frame of image. It isdetermined whether a difference between a number of light sources of akth frame of image and a number of light sources of a continuous (k+1)thframe of image is equal to 0. Responsive to determining that thedifference is unequal to 0, a color temperature of the (k+1)th frame ofimage is determined to be a color temperature of the kth frame of imageand the (k+1)th frame of image is processed according to the colortemperature of the (k+1)th frame of image.

According to a second aspect, the embodiments of the disclosure providean image processing device. The image processing apparatus may include amemory and a processor. The memory stores one or more computer programsthat, when executed by the processor, cause the processor to implementthe image processing method described in the first aspect.

According to a third aspect, the embodiments of the disclosure provide anon-transitory computer-readable storage medium including acomputer-executable instruction. The computer-executable instruction maybe executed by one or more processors to enable the processor to executethe image processing method described in the first aspect.

The computer device according to the embodiments of the disclosure mayinclude a memory and a processor. The memory may store acomputer-readable instruction, and the instruction may be executed bythe processor to enable the processor to execute the image processingmethod.

Additional aspects and advantages of the disclosure will be partiallypresented in the following descriptions and partially become apparentfrom the following descriptions or get understood by implementing thedisclosure.

BRIEF DESCRIPTION OF DRAWINGS

In order to describe the technical solutions in the embodiments of thedisclosure or a conventional art more clearly, the drawings required tobe used in descriptions about the embodiments or the conventional artwill be simply introduced below. It is apparent that the drawingsdescribed below are only some embodiments of the disclosure. Otherdrawings may further be obtained by those of ordinary skill in the artaccording to these drawings without creative work.

FIG. 1 is a flowchart of an image processing method according to someembodiments of the disclosure.

FIG. 2 is a schematic diagram of an image processing device according tosome embodiments of the disclosure.

FIG. 3 is a schematic plan view of a computer device according to someembodiments of the disclosure.

FIG. 4 is a schematic flowchart of an image processing method accordingto some embodiments of the disclosure.

FIG. 5 is a schematic diagram of a first processing module according tosome embodiments of the disclosure.

FIG. 6 is a schematic diagram of a scenario of an image processingmethod according to some embodiments of the disclosure.

FIG. 7 is a schematic diagram of a scenario of an image processingmethod according to some embodiments of the disclosure.

FIG. 8 is a histogram formed by a region in an image processing methodaccording to some embodiments of the disclosure.

FIG. 9 is a schematic flowchart of an image processing method accordingto some embodiments of the disclosure.

FIG. 10 is a module schematic diagram of a first processing moduleaccording to some embodiments of the disclosure.

FIG. 11 is a schematic diagram of a scenario of an image processingmethod according to some embodiments of the disclosure.

FIG. 12 is a schematic diagram of a color temperature curve according tosome embodiments of the disclosure.

FIG. 13 is a schematic flowchart of an image processing method accordingto some embodiments of the disclosure.

FIG. 14 is a schematic diagram of a second processing module accordingto some embodiments of the disclosure.

FIG. 15 is a schematic diagram of a scenario of an image processingmethod according to some embodiments of the disclosure.

FIG. 16 is a schematic diagram of a scenario of an image processingmethod according to some embodiments of the disclosure.

FIG. 17 is a schematic diagram of a scenario of an image processingmethod according to some embodiments of the disclosure.

FIG. 18 is a schematic flowchart of an image processing method accordingto some embodiments of the disclosure.

FIG. 19 is a schematic diagram of an image processing device accordingto some embodiments of the disclosure.

FIG. 20 is a schematic diagram of a scenario of an image processingmethod according to some embodiments of the disclosure.

FIG. 21 is a schematic flowchart of an image processing method accordingto some embodiments of the disclosure.

FIG. 22 is a schematic diagram of a third processing module according tosome embodiments of the disclosure.

FIG. 23 is a schematic diagram of a computer device according to someembodiments of the disclosure.

FIG. 24 is a schematic diagram of an image processing circuit accordingto some embodiments of the disclosure.

DETAILED DESCRIPTION

According to the image processing method and device, computer-readablestorage medium and computer device of the embodiments of the disclosure,it is determined whether the number of the light sources between twocontinuous frames of images in the multiple continuous frames of imageschanges. After the number of the light sources changes, white balanceregulation is performed on the latter frame of image according to acolor temperature of the former frame of image. When the number of thelight sources does not change, white balance regulation is performed onthe image by use of a color temperature of the image. In such a manner,image tone jump caused by the fact that shaking of a lens makes thelight sources or part of the light sources in and out randomly may beprevented, stability of a white balance processing effect is ensured,and a user experience is improved.

In order to make the purposes, technical solutions and advantages of thedisclosure clearer, the disclosure will further be described below incombination with the drawings and the embodiments in detail. It shouldbe understood that specific embodiments described herein are onlyadopted to explain the disclosure and not intended to limit thedisclosure.

Referring to FIG. 1, an image processing method according to theembodiments of the disclosure includes the following operations atblocks S12 to S16.

At block S12, each frame of image in multiple continuous frames ofimages is processed to determine the number of light sources of eachframe of image.

At block S14, it is determined whether a difference between the numberof the light sources of a kth frame of image and the number of the lightsources of a (k+1)th frame of image is equal to 0.

At block S16, responsive to determining that the difference is unequalto 0, a color temperature of the (k+1)th frame of image is determined tobe a color temperature of the kth frame of image and the (k+1)th frameof image is processed according to the color temperature of the (k+1)thframe of image.

In the embodiments of the disclosure, k may be a positive integer.

Referring to FIG. 2, an image processing device 10 according to theembodiments of the disclosure includes a first processing module 12, ajudgment module 14 and a second processing module 16. The firstprocessing module 12 is configured to process each frame of image inmultiple continuous frames of images to determine the number of lightsources of each frame of image. The judgment module 14 is configured tojudge whether a difference between the number of the light sources of akth frame of image and the number of the light sources of a (k+1)thframe of image is equal to 0. The second processing module 16 isconfigured to, responsive to determining that the difference is unequalto 0, determine a color temperature of the (k+1)th frame of image to bea color temperature of the kth frame of image and process the (k+1)thframe of image according to the color temperature of the (k+1)th frameof image.

The image processing method according to the embodiments of thedisclosure may be implemented by the image processing device 10 of theembodiments of the disclosure. The operation at block S12 may beimplemented by the first processing module 12, the operation at blockS14 may be implemented by the judgment module 14 and the operation atblock S16 may be implemented by the second processing module 16.

Referring to FIG. 3, the image processing device 10 according to theembodiments of the disclosure may be applied to a computer device 100 ofthe embodiments of the disclosure. That is, the computer device 100 ofthe embodiments of the disclosure may include the image processingdevice 10 of the embodiments of the disclosure.

In some embodiments, the computer device 100 includes a mobile phone, atablet computer, a notebook computer, a smart band, a smart watch, asmart helmet, smart glasses and the like.

According to the image processing method, image processing device 10 andcomputer device 100 of the embodiments of the disclosure, it isdetermined whether the number of the light sources between twocontinuous frames of images in the multiple continuous frames of imageschanges, after the number of the light sources changes, white balanceregulation is performed on the latter frame of image according to acolor temperature of the former frame of image, and when the number ofthe light sources does not change, white balance regulation is performedon the image by use of a color temperature of the image. In such amanner, image tone jump caused by the fact that shaking of a lens makesthe light sources or part of the light sources in and out randomly maybe prevented, thereby ensuring stability of a white balance processingeffect and improving the user experience.

In some embodiments, the multiple continuous frames of images refer tomultiple continuous frames of images obtained by continuously arranging,along a time axis, multiple frames of images obtained at fixed timeintervals according to a frame rate of a camera within a period of time.

Referring to FIG. 4, in some embodiments, the operation at block S12includes the following actions at blocks S122 to S128.

At block S122, each frame of image is divided into multiple regions.

At block S124, for each of the multiple regions, it is determinedwhether the region is a target region including a light source accordingto a histogram of the region.

At block S126, when the region is the target region including a lightsource, it is determined whether there are multiple target regionsadjacent to the region.

At block S128, when there are multiple target regions adjacent to theregion, the multiple target regions are spliced into a light source.

At block S121, when there are no target regions adjacent to the region,the target region is determined as a light source.

At block S123, the light sources are counted.

Referring to FIG. 5, in some embodiments, the first processing module 12includes a division unit 122, a first judgment unit 124, a secondjudgment unit 126, a splicing unit 128, a first determination unit 121and a counting unit 123. The division unit 122 may be configured todivide an image into multiple regions. The first judgment unit 124 maybe configured to, for each of the multiple regions, judge whether theregion is a target region including a light source according to ahistogram of the region. The second judgment unit 126 may be configuredto judge whether there are multiple target regions adjacent to theregion. The splicing unit 128 may be configured to, when there aremultiple target regions adjacent to the region, splice the multipletarget regions into a light source. The first determination unit 121 maybe configured to, when there are no target regions adjacent to theregion, determine the target region as a light source. The counting unit123 may be configured to count the light sources.

That is, the operation at block S122 may be implemented by the divisionunit 122, the operation at block S124 may be implemented by the firstjudgment unit 124, the operation at block S126 may be implemented by thesecond judgment unit 126, the operation at block S128 may be implementedby the splicing unit 128, the operation at block S121 may be implementedby the first determination unit 121 and the operation at block S123 maybe implemented by the counting unit 123.

In such a manner, positions and number of the light sources in the imagemay be determined.

Specifically, referring to FIG. 6 to FIG. 8, in an embodiment, accordingto the image processing method, each frame of image is divided intomultiple regions at first, for example, 4*5 regions. Four histograms maybe drawn for each region according to channel values of Red (R), Green(Gr), Greenish Blue (Gb) and Blue (B). Then, it is determined for eachregion whether the region is a target region including a light sourceaccording to the four histograms of the region. As illustrated in FIG. 6and FIG. 7, both of images include multiple target regions. For example,the image in FIG. 6 includes three target regions and the image in FIG.7 includes eight target regions. According to the image processingmethod, when there is one region that is the target region including thelight source, it is determined whether there are multiple target regionsadjacent to the region. That is, it is determined whether multipletarget regions are covered by the same light source. The multiple targetregions may be covered in a partial coverage or complete coveragemanner. According to the image processing method, when there aremultiple adjacent target regions, the multiple adjacent target regionsare spliced into a light source, and when there are no adjacent targetregions, each target region is determined as a light source. Referringto FIG. 6, the three non-adjacent target regions are determined as alight source R, a light source G and a light source B respectively.Referring to FIG. 7, six adjacent target regions are spliced into acomplete light source R, and the other two non-adjacent target regionsare determined as a light source G and a light source B respectively.

In addition, it is to be noted that the method for drawing a histogramof a region in FIG. 8 is only an example. As illustrated in FIG. 8, anabscissa axis of the histogram represents pixel value and an ordinateaxis represents the number of pixels. In another embodiment, theabscissa axis of the histogram may also represent the number of pixelsand the ordinate axis may represent pixel value. Alternatively, theabscissa axis of the histogram represents a proportion of the number ofpixels and the ordinate axis represents pixel value. Alternatively, theabscissa axis of the histogram represents pixel value and the ordinateaxis of the histogram represents the proportion of the number of pixels.

In some embodiments, the determination regarding whether a certainregion is a target region including a light source according to ahistogram of the region may be made by determining whether a proportionof the number of pixels with pixel values exceeding a predeterminedvalue exceeds a predetermined proportion. For example, the determinationmay be made by determining whether a proportion of the number of pixelswith pixel values exceeding 239 exceeds 5%. When the proportion of thenumber of the pixels with pixel values exceeding 239 exceeds 5%, it isindicated that the region is a target region including a light source.When the proportion of the number of the pixels with pixel valuesexceeding 239 does not exceed 5%, it is indicated that the region is nota target region including a light source.

Referring to FIG. 9, in some embodiments, the operation at block S12further includes the following actions at blocks S125 to S127.

At block S125, a high-luminance region and a medium-luminance region aredetermined according to a luminance distribution extending outwards froma center of a light source along a radial direction of the light source.

At block S127, a color of the light source is determined by subtractingpixel averages of primary color channels of the medium-luminance regionfrom pixel averages of primary color channels of the high-luminanceregion to obtain a color temperature of the light source.

Referring to FIG. 10, in some embodiments, the first processing module12 further includes a second determination unit 125 and a thirddetermination unit 127. The second determination unit 125 may beconfigured to determine a high-luminance region and a medium-luminanceregion according to a luminance distribution extending outwards from acenter of a light source along a radial direction of the light source.The third determination unit 127 may be configured to determine a colorof the light source by subtracting pixel averages of primary colorchannels of the medium-luminance region from pixel averages of primarycolor channels of the high-luminance region to obtain a colortemperature of the light source.

That is, the operation at block S125 may be implemented by the seconddetermination unit 125 and the operation at block S127 may beimplemented by the third determination unit 127.

In such a manner, after the position and the number of the light sourcesin each frame of image are determined, the color of each light sourcemay be determined through the high-luminance regions and themedium-luminance regions, and thus the color temperature of each lightsource may be obtained. When the number of light sources are more than1, i.e., there are multiple light sources in the image, the colortemperature of a primary light source may be determined according to thecolors of the light sources, so that the color temperatures of the lightsources may be estimated more accurately.

Referring to FIG. 11, after a position of a light source in an image isdetermined, it is to be understood that a central region O of the lightsource in the image is an overexposed region, which is usually a largewhite spot and does not include information on a color of the lightsource. The color of the light source may be determined based on pixelaverages of primary color channels of a high-luminance region H and amedium-luminance region M. The high-luminance region H may refer to aregion formed by pixels of which luminance values extending outwardsradially from a center of the light source are within a first luminancerange L1, and the first luminance range L1 is, for example, [200, 239).The medium-luminance region M may refer to a region formed by pixels ofwhich luminance values extending outwards radially from the center ofthe light source are within a second luminance range L2, and the secondluminance range L2 is, for example, [150, 200). It is to be noted thatspecific values of the first luminance range L1 and the second luminancerange L2 may be determined according to a luminance distribution,extending outwards radially from the center O, of the light source. Forexample, when luminance of the light source is attenuated relativelyfast, the first luminance range L1 and the second luminance range L2 maybe enlarged. For example, when the luminance of the light source isattenuated relatively slowly, the first luminance range L1 and thesecond luminance range L2 may be narrowed.

The pixel average of the primary color channel of the high-luminanceregion is an average of pixel values of all pixels of the high-luminanceregion, and the pixel average of the primary color channel of themedium-luminance region is an average of pixel values of all pixels ofthe medium-luminance region. Assume that the number of the pixels of thehigh-luminance region is C1 and the number of the pixels of themedium-luminance region is C2. Then, the pixel average of the primarycolor channel of the high-luminance region is

${\overset{\_}{H} = \frac{\left( {{\sum_{1}^{C\; 1}R},{\sum_{1}^{C\; 1}G},{\sum_{1}^{C\; 1}B}} \right)}{C\; 1}},$

and the pixel average of the primary color channel of themedium-luminance region is:

$\overset{\_}{M} = {\frac{\left( {{\sum_{1}^{C\; 2}R},{\sum_{1}^{C\; 2}G},{\sum_{1}^{C\; 2}B}} \right)}{C\; 2}.}$

The pixel average M of the primary color channel of the medium-luminanceregion is subtracted from the pixel average H of the primary colorchannel of the high-luminance region, i.e., H−M, to determine a color ofthe light source. A color temperature of the light source maycorrespondingly be determined according to the color of the lightsource. In some embodiments, the operation that the color temperature ofthe light source is determined according to the color of the lightsource may specifically be implemented as follows: the color temperatureof the light source is determined according to the color of the lightsource and a correspondence between a color of a light source and acolor temperature of the light source. The correspondence between thecolor of the light source and the color temperature of the light sourcemay be a mapping table and/or a color temperature curve (as illustratedin FIG. 12). Specifically, in an embodiment, images may be acquiredunder standard light boxes of which color temperatures are 3,000K,4,000K, 5,000K, 6,000K, . . . respectively, corresponding values of H−Munder different color temperatures are calculated, and thus a mappingtable or color temperature curve between H−M and color temperatures oflight sources may be formed. The color temperature curve or the mappingtable may be stored in a local database. In the embodiments of thedisclosure, after H−M is calculated, the color temperatures of thecorresponding light sources may be queried from the color temperaturecurve or the mapping table. Then, corresponding white balance parametersmay be found according to the color temperatures of the light sourcesand a correspondence between a color temperature of a light source andwhite balance parameters, and thus white balance processing may beperformed on the images according to the white balance parameters.

In some embodiments, a primary color channel refers to a color channeland, for example, includes at least one of an R channel, a Gr channel, aGb channel or a B channel. In some embodiments, a pixel value of the Gchannel may be obtained based on a pixel value of the Gr channel and apixel value of the Gb channel. A pixel average may refer to anarithmetic mean of pixel values. In an example, pixel averages (Ravg,Gavg, Bavg) of each primary color channel of the high-luminance regionare (200, 210, 220), pixel averages (Ravg, Gavg, Bavg) of each primarycolor channel of the medium-luminance region are (160, 180, 190), andthen color channels (R, G, B) of the light source are (200-160, 210-180,220-190), i.e., (40, 30, 30). Therefore, the color of the light sourcemay be determined as red.

Referring to FIG. 13, in some embodiments, the operation at block S16further includes the following actions at blocks S162 to S168.

At block S162, it is determined whether the number of the light sourcesof the kth frame of image is more than or equal to 1.

At block S164, when the number of the light sources of the kth frame ofimage is less than 1, a gray world method is adopted to perform whitebalance processing on the kth frame of image and the (k+1)th frame ofimage.

At block S166, when the number of the light sources of the kth frame ofimage is equal to 1, the color temperature and number of the lightsources of the (k+1)th frame of image are determined according to acolor temperature and number of the light sources of the kth frame ofimage, and white balance processing is performed on the (k+1)th frame ofimage according to the color temperature of the (k+1)th frame of image.

At block S168, when the number of the light sources of the kth frame ofimage is more than 1, a primary light source is determined according toat least one of scenario parameters, areas or luminance parameters ofthe light sources of the kth frame of image, the color temperature ofthe (k+1)th frame of image is determined according to the colortemperature of the primary light source, white balance processing isperformed on the (k+1)th frame of image according to the colortemperature of the (k+1)th frame of image, and the number of the lightsources of the (k+1)th frame of image is determined to be the number ofthe light sources of the kth frame of image. In the example, thescenario parameters include image shooting time and signal strength of aGlobal Positioning System (GPS) and the luminance parameters includeluminance of multiple light sources.

Referring to FIG. 14, in some embodiments, the second processing module16 includes a third judgment unit 162, a first processing unit 164, asecond processing unit 166 and a third processing unit 168. The thirdjudgment unit 162 may be configured to judge whether the number of thelight sources of the kth frame of image is more than or equal to 1. Thefirst processing unit 164 may be configured to, when the number of thelight sources of the kth frame of image is less than 1, adopt a grayworld method to perform white balance processing on the kth frame ofimage and the (k+1)th frame of image. The second processing unit 166 maybe configured to, when the number of the light sources of the kth frameof image is equal to 1, determine the color temperature and number ofthe light sources of the (k+1)th frame of image according to a colortemperature and number of the light sources of the kth frame of imageand perform white balance processing on the (k+1)th frame of imageaccording to the color temperature of the (k+1)th frame of image. Thethird processing unit 168 may be configured to, when the number of thelight sources of the kth frame of image is more than 1, determine aprimary light source according to at least one of scenario parameters,areas or luminance parameters of the light sources of the kth frame ofimage, determine the color temperature of the (k+1)th frame of imageaccording to the color temperature of the primary light source, performwhite balance processing on the (k+1)th frame of image according to thecolor temperature of the (k+1)th frame of image and determine the numberof the light sources of the (k+1)th frame of image to be the number ofthe light sources of the kth frame of image. In the example, thescenario parameters include image shooting time and signal strength of aGlobal Positioning System (GPS) and the luminance parameters includeluminance of multiple light sources.

That is, the operation at block S162 may be implemented by the thirdjudgment unit 162, the operation at block S164 may be implemented by thefirst processing unit 164, the operation at block S166 may beimplemented by the second processing unit 166 and the operation at blockS168 may be implemented by the third processing unit 168.

Therefore, when the kth frame of image does not include any light source(i.e., the number of the light sources is less than 1), the gray worldmethod is adopted to perform white balance processing. When the kthframe of image includes only one light source, the color temperature ofthe (k+1)th frame of image is determined according to the colortemperature of the light source. When the (k+1)th frame of imageincludes multiple light sources, the primary light source is determinedaccording to at least one of scenario parameters, respective areas orluminance parameters of the multiple light sources, and the colortemperature of the (k+1)th frame of image is determined according to thecolor temperature of the primary light source. Then, white balanceprocessing is performed on the (k+1)th frame of image according to thecolor temperature of the (k+1)th frame of image and the number of thelight sources of the (k+1)th frame of image is determined to be thenumber of the light sources of the kth frame of image. That is, thecolor temperature and number of the light sources of the kth frame ofimage are both assigned to the (k+1)th frame of image. When differencesbetween the numbers of the light sources of multiple frames of imagesafter the (k+1)th frame of image and the number of the light sources ofthe kth frame are not equal to 0, white balance processing may beperformed according to the color temperature of the kth frame of image.In such a manner, after the number of the light sources changes, thecolor temperature for white balance processing may be locked until thenumber of the light sources returns to the original, i.e., the number ofthe light sources of the kth frame. Therefore, color temperature jump ofa preview image caused by a change in the number of the light sources isavoided, and a user experience is improved.

Specifically, as illustrated in FIG. 15, when the computer device 100(for example, a mobile phone) shoots an image, there are three lightsources in the image, which are a light source R, a light source G and alight source B respectively. When a user shakes, the light source R isout of the image and the image A is changed to an image B. In such acase, a tone of the image B may jump. For preventing image tone jumpcaused by the change in the light sources, the image processing device10 of the mobile phone detects a difference between the numbers of thelight sources of two continuous frame images and, when the differencebetween the numbers of the light sources is not equal to 0, indicatingthat the number of the light sources of the latter frame of imagechanges, performs white balance regulation on the latter frame of imageby using a color temperature of the former frame of image. In this case,a tone of the image may not jump and, instead, is substantially keptconsistent with a tone of the former frame of image. Moreover, duringwhite balance, the number of the light sources of the latter frame ofimage is set to be the number of the light sources of the former frameof image, so as to avoid the condition that a tone of the next of thelatter frame of image jumps due to a misjudgment when the number of thelight sources of the next of the latter frame of image is the same asthe number of the light sources of the latter frame of image.

In some embodiments, the number of the light sources is manuallyadjusted by the user to be decreased or increased to obtain an imagewith higher quality and does not return to the number of the lightsources before the change. For this condition, a predetermined framenumber h may be set and white balance regulation is performed accordingto a color temperature of a (k+1)th frame of image when a differencebetween the number of the light sources of the (k+h)th and the number ofthe light sources of the kth frame of image is kept unequal to 0. Forexample, as for a certain (for example, (k+x)th) frame of image betweenthe kth frame and the (k+h)th frame, when a difference between thenumber of the light sources of the (k+h)th frame of image and the numberof the light sources of the kth frame of image is equal to 0, the(k+x)th frame is taken as a reference again. When a difference betweenthe number of the light sources of a (k+x+h)th frame of image and thenumber of the light sources of the (k+x)th frame of image is not equalto 0, white balance regulation is performed on a color temperature ofthe (k+x+h)th frame according to the color temperature of the (k+x+h)thframe of image. That is, when the number of the light sources of animage after the predetermined frame number is still different from thenumber of the light sources of the kth frame of image, white balanceregulation is not performed by using the color temperature of the kthframe of image all the time, and instead, white balance regulation isautomatically performed on the present image according to a colortemperature of the present image.

In such a manner, it is intelligently judged whether the number of thelight sources changes due to active regulation of the user or accidentalshaking, so as to avoid the condition that white balance is performed onall images by use of the same color temperature once the number of thelight sources changes and does not return to the number of the lightsources before the change when the user photographs. That is, it mayavoid the case that active regulation of the user changes the number ofthe light sources but may not achieve accurate white balance. Not onlyis the problem of frequent image tone change caused by the fact that thelight sources are randomly incident and emergent solved, but alsoinfluence on a normal shooting experience of the user may be avoided.

In some embodiments, the operation that the gray world method is adoptedto process the image may include the following actions.

Values of primary color channels of all pixels of the image are counted.

Averages of the values of the three primary color channels (R, G, B) arecalculated.

White balance regulation values of the channels R, G and B aredetermined according to the averages.

White balance regulation is performed on the image according to thewhite balance regulation values.

Specifically, the pixel averages (R_(avg), G_(avg), B_(avg)) of theprimary color channels of the image are obtained by calculating data ofthe primary color channels of the image and then the white balanceregulation values K/P_(avg), K G_(avg) and K/B_(avg) of each channel arecalculated according to the averages, in which K=(R_(avg), G_(avg),B_(avg))/3. In such a manner, white balance processing may be performedon the whole image according to the white balance regulation values forthe values of the primary color channels.

Therefore, white balance processing may be performed on the image underthe condition of no light source.

In some embodiments, a primary light source is determined according toat least one of scenario parameters, respective areas or luminanceparameters of multiple light sources.

A specific period where present time is located may be distinguishedaccording to image shooting time. A specific position where the user mayshoot in the present period may be determined through a timetable habit,stored in the local database, of the user. For example, the user usuallyhas lunch in a dining room at 12 o'clock and the user usually readsbooks in a living room after 8 p.m. In this way, it may be substantiallydetermined whether the user is located in an indoor environment, anoutdoor environment or a specific scenario according to the imageshooting time. In addition, outdoor GPS signal strength is usuallyhigher than indoor GPS signal strength. Therefore, it may besubstantially distinguished whether the user is located in the indoorenvironment or the outdoor environment according to the GPS signalstrength. It can be understood that a color temperature of an indoorlight source is usually lower than 5,000K. For example, a colortemperature of a tungsten filament lamp is 2,760-2,900K and a colortemperature of a flashlight is 3,800K. A color temperature of an outdoorlight source is usually higher than 5,000K. For example, a colortemperature of the midday sunlight is 5,000K and a color temperature ofthe blue sky is 10,000K. Therefore, it may be substantially determinedwhether a present color temperature should be higher than 5,000K orlower than 5,000K according to the indoor environment or outdoorenvironment where the user is located. As illustrated in FIG. 16, forexample, a color temperature of a light source R is 4.500K, a colortemperature of a light source G is 3,500K, a color temperature of alight source B is 7,000K, and it is determined that the present colortemperature should be 5,000K according to a scenario parameter. It isapparent that the light source R is closest to the present colortemperature of the scenario and thus the light source R is determined asa primary light source. Therefore, the primary light source may bedetermined.

When the primary light source is determined according to the respectiveareas of the multiple light sources, the areas of the multiple lightsources may be compared and the light source with the largest area isselected as the primary light source. For example, in FIG. 16, an areaof the light source R is larger than that of the light source G andlarger than that of the light source B, and thus the light source R isdetermined as the primary light source.

When the primary light source is determined according to respectiveluminance of the multiple light sources, it can be understood that thelight source with higher luminance usually has greater influence on thewhole image. As illustrated in FIG. 17, when areas of light sources arethe same, luminance of the light source R is 150, luminance of the lightsource G is 100, luminance of the light source B is 200, and then thelight source B is determined as a primary light source. In such a case,when the areas of the light sources are the same, the light source withhighest luminance is determined as the primary light source.

According to the image processing method of the embodiments of thedisclosure, the primary light source may be determined according to acombination of the image shooting time of the multiple light sources andthe GPS signal strength, or the primary light source may be determinedaccording to the areas of the multiple light sources, or the primarylight source may be determined according to a combination of therespective luminance of the multiple light sources and average luminanceof the images, or the primary light source may be determined accordingto the areas of the multiple light sources and the combination of theimage shooting time of the multiple light sources and the GPS signalstrength, or the primary light source may be determined according to thecombination of the image shooting time of the multiple light sources andthe GPS signal strength and the combination of the respective luminanceof the multiple light sources and the average luminance of the images,or the primary light source may be determined according to the areas ofthe multiple light sources and the combination of the respectiveluminance of the multiple light sources and the average luminance of theimages, or the primary light source may be determined according to thecombination of the image shooting time of the multiple light sources andthe GPS signal strength, the areas and the combination of the respectiveluminance of the multiple light sources and the average luminance of theimages.

In at least one embodiment, according to the image processing method,the primary light source may be determined according to the combinationof the image shooting time of the multiple light sources and the GPSsignal strength, the areas and the combination of the respectiveluminance and the average luminance of the images. Different weights maybe set for the combination of the image shooting time of the multiplelight sources and the GPS signal strength, the areas and the combinationof the respective luminance and the average luminance of the imagesrespectively. In such a manner, the primary light source may be selectedaccurately, and a white balance effect expected by the user may beachieved better when white balance processing is performed on the image.

Referring to FIG. 18, in some embodiments, the image processing methodfurther includes the operation at block S18.

At block S18, when the difference is equal to 0, white balanceprocessing is performed on an mth frame of image according to a colortemperature of the mth frame of image, wherein the mth frame of imageincludes the kth frame of image and the (k+1)th frame of image.

In the embodiments, m may be a positive integer and m≥k

Referring to FIG. 19, in some embodiments, the image processing devicefurther includes a third processing module 18. The third processingmodule may be configured to, when the difference is equal to 0, performwhite balance processing on an mth frame of image according to a colortemperature of the mth frame of image, wherein the mth frame of imageincludes the kth frame of image and the (k+1)th frame of image.

That is, the operation at block S18 may be implemented by the thirdprocessing module 18.

In such a manner, through determining the change in the number of thelight sources, it may be avoided that white balance processing isperformed according to the color temperature of the image after thenumber of the light sources returns to normal while image tone jumpoccurs during photographing. Therefore, white balance accuracy may beimproved while avoiding image tone jump.

Specifically, as illustrated in FIG. 15 and FIG. 20, the image acquiredby the image processing device 10 is changed from the image A to theimage B and then changed from the image B to an image C, and the lightsource R disappears from the image A and appears in the image C. Sincethe number of light sources of the image B is obtained by assignmentwith the number of light sources of the image A and the number of thelight sources of the image A is the same as the number of light sourcesof the image C, the number of the light sources of the image B is thesame as the number of the light sources of the image C. It can beunderstood that there is no tone jump problem for a tone of the image Crelative to a tone of the image B when the number of the light sourceschanges. In such a case, white balance processing may be performed onthe present frame of image according to a color temperature of thepresent frame of image (the image C), such that a more accuratewhite-balanced image may be obtained under the condition of ensuring theuser experience.

Referring to FIG. 21, in some embodiments, the operation at block S18includes the following actions at blocks S182 to S188.

At block S182, it is determined whether the number of the light sourcesis more than or equal to 1.

At block S184, when the number of the light sources is less than 1, thegray world method is adopted to perform white balance processing on theimage.

At block S186, when the number of the light sources is equal to 1, whitebalance processing is performed on the image according to the colortemperature of the light source.

At block S188, when the number of the light sources is larger than 1,the primary light source is determined according to at least one of thescenario parameters, areas or luminance parameters of the light sourcesand white balance processing is performed on the image according to thecolor temperature of the primary light source. In the example, thescenario parameters include the image shooting time and the GPS signalstrength and the luminance parameters include the luminance of themultiple light sources.

Referring to FIG. 22, in some embodiments, the third processing module18 includes a fourth judgment unit 182, a fourth processing unit 184, afifth processing unit 186 and a sixth processing unit 188. The fourthjudgment unit 182 may be configured to judge whether the number of thelight sources is more than or equal to 1. The fourth processing unit 184may be configured to, when the number of the light sources is less than1, adopt the gray world method to perform white balance processing onthe image. The fifth processing unit 186 may be configured to, when thenumber of the light sources is equal to 1, perform white balanceprocessing on the image according to the color temperature of the lightsource. The sixth processing unit 188 may be configured to, when thenumber of the light sources is larger than 1, determine the primarylight source according to at least one of the scenario parameters, areasor luminance parameters of the light sources and perform white balanceprocessing on the image according to the color temperature of theprimary light source, wherein the scenario parameters include the imageshooting time and the GPS signal strength and the luminance parametersinclude the luminance of the multiple light sources.

That is, the operation at block S182 may be implemented by the fourthjudgment unit 182. The operation at block S184 may be implemented by thefourth processing unit 184. The operation at block S186 may beimplemented by the fifth processing unit 186 and the operation at blockS188 may be implemented by the sixth processing unit 188.

In such a manner, when the difference between the numbers of the lightsources is equal to 0, it is determined whether the number of the lightsources is more than or equal to 1. When there is no light source (i.e.,the number of the light sources is less than 1), the gray world methodis adopted to perform white balance processing. When the number of thelight sources is equal to 1, white balance processing is performedaccording to the color temperature of the light source of the mth frameof image. When the number of the light sources is larger than 1, theprimary light source is determined at first according to at least one ofthe scenario parameters, respective areas and luminance parameters ofthe light sources of the mth frame image and then white balanceprocessing is performed according to the color temperature of theprimary light source. The primary light source may be selectedaccurately, so that a good white balance processing effect is achieved.

An embodiment of the disclosure further provides a computer-readablestorage medium. One or more nonvolatile computer-readable storage mediaincludes a computer-executable instruction, and the computer-executableinstruction is executed by one or more processors to enable theprocessor to execute the following operations at blocks S12 to S16.

At block S12, each frame of image in multiple continuous frames ofimages is processed to determine the number of light sources of eachframe of image.

At block S14, it is determined whether a difference between the numberof the light sources of a kth frame of image and the number of the lightsources of a (k+1)th frame of image is equal to 0.

At block S16, responsive to determining that the difference is unequalto 0, a color temperature of the (k+1)th frame of image is determined tobe a color temperature of the kth frame of image and the (k+1)th frameof image is processed according to the color temperature of the (k+1)thframe of image.

FIG. 23 is an internal structure diagram of a computer device accordingto an embodiment of the disclosure. As illustrated in FIG. 23, thecomputer device 100 includes a processor 52, a memory 53 (for example, anonvolatile storage medium), an internal memory 54, a display screen 55and an input device 56, all of which are connected through a system bus51. The memory 53 of the computer device 100 may store an operatingsystem and a computer-readable instruction. The computer-readableinstruction may be executed by the processor 52 to implement an imageprocessing method of the embodiments of the disclosure. The processor 52may be configured to provide calculation and control capability tosupport running of the whole computer device 100. The internal memory 53of the computer device 100 may provide an environment for running of thecomputer-readable instruction in the memory 52. The display screen 55 ofthe computer device 100 may be a liquid crystal display screen, anelectronic ink display screen or the like. The input device 56 may be atouch layer covering the display screen 55, may also be a key, atrackball or a touch pad arranged on a housing of the computer device100 and may further be an external keyboard, a touch pad, a mouse or thelike. The computer device 100 may be a mobile phone, a tablet computer,a notebook computer, a personal digital assistant, a wearable device(for example, a smart band, a smart watch, a smart helmet and smartglasses) or the like. Those skilled in the art may know that a structureillustrated in FIG. 23 is only a schematic diagram of a part ofstructure related to the solutions of the disclosure and not intended tolimit the computer device 100 to which the solutions of the disclosureare applied. The computer device 100 may specifically include componentsmore or less than those illustrated in the figure, or some componentsare combined or different component arrangements are adopted.

Referring to FIG. 24, the computer device 100 of the embodiments of thedisclosure includes an image processing circuit 80. The image processingcircuit 80 may be implemented by use of a hardware and/or softwarecomponent, and may include various processing units defining an ImageSignal Processing (ISP) pipeline. FIG. 24 is a schematic diagram of animage processing circuit 800 according to an embodiment of thedisclosure. As illustrated in FIG. 24, aspects of an image processingtechnology related to the embodiments of the disclosure are illustratedonly, for convenient description.

As illustrated in FIG. 24, the image processing circuit 80 may includean ISP unit 81 (the ISP unit 81 may be the processor 52 or part of theprocessor 52) and a control logic unit 82. Image data captured by acamera 83 may be processed by the ISP unit 81 at first, and the ISP unit81 may analyze the image data to capture image statistical informationavailable for determining one or more control parameters of the camera83. The camera 83 may include one or more lenses 832 and an image sensor834. The image sensor 834 may include a color filter array (for example,a Bayer filter), and the image sensor 834 may acquire light intensityand wavelength information captured by each imaging pixel and provide aset of original image data processed by the ISP unit 81. The sensor 84(for example, a gyroscope) may provide acquired image processingparameters (for example, an anti-shake parameter) to the ISP unit 81based on an interface type of the sensor 84. An interface of the sensor84 may be a Standard Mobile Imaging Architecture (SMIA) interface,another serial or parallel camera interface or a combination of theinterfaces.

In addition, the image sensor 834 may also send original image data tothe sensor 84. The sensor 84 may provide the original image data to theISP unit 81 based on the interface type of the sensor 84, or the sensor84 stores the original image data in an image memory 85.

The ISP unit 81 may process the original image data pixel by pixelaccording to multiple formats. For example, each image pixel may have abit depth of 8, 10, 12 or 14 bits. The ISP unit 81 may execute one ormore image processing operations on the original image data and collectthe image statistical information about the image data. The imageprocessing operations may be executed according to the same or differentbit depth accuracy.

The ISP unit 81 may further receive the image data from the image memory85. For example, the interface of the sensor 84 may send the originalimage data to the image memory 85, and the original image data in theimage memory 85 may be provided to the ISP unit 81 for processing. Theimage memory 85 may be the memory 53, a part of the memory 53, a storagedevice or an independent dedicated memory in electronic equipment, andmay include a Direct Memory Access (DMA) feature.

When receiving the original image data from the interface of the imagesensor 834 or from the interface of the image sensor 84 or from theimage memory 85, the ISP unit 81 may execute one or more imageprocessing operations, for example, time-domain filtering. The processedimage data may be sent to the image memory 85 for other processingbefore displaying. The ISP unit 81 may receive the processed data fromthe image memory 85 and perform image data processing in an originaldomain and color spaces RGB and YCbCr on the processed data. The imagedata processed by the ISP unit 81 may be output to a display 87 (thedisplay 87 may include the display screen 55) for a user to view and/orfor further processing by a Graphics Processing Unit (GPU). In addition,output of the ISP unit 81 may further be sent to the image memory 85,and the display 87 may read the image data from the image memory 85. Inan embodiment of the disclosure, the image memory 85 may be configuredto implement one or more frame buffers. Moreover, the output of the ISPunit 81 may be sent to a coder/decoder 86 to code/decode the image data.The coded image data may be stored, and may be decompressed before beingdisplayed on the display 87. The coder/decoder 86 may be implemented bya Central Processing Unit (CPU) or a GPU or a coprocessor.

The statistical information determined by the ISP unit 81 may be sent tothe control logic unit 82. For example, the statistical information mayinclude statistical information of automatic exposure, automatic whitebalance, automatic focusing, flashing detection, black levelcompensation, shading correction of the lens 832 and the like of theimage sensor 834. The control logic unit 82 may include a processingcomponent and/microcontroller executing one or more routines (forexample, firmware), and the one or more routines may determine thecontrol parameters of the camera 83 and the control parameters of theISP unit 81 according to the received statistical data. For example, thecontrol parameters of the camera 83 may include a control parameter (forexample, a gain, integral time for exposure control and the anti-shakeparameter) for the sensor 84, a camera flashing control parameter, acontrol parameter (for example, a focal length for focusing or zooming)for the lens 832 or a combination of these parameters. The controlparameters for the ISP unit may include a gain level and colorcorrection matrix for automatic white balance and color regulation (forexample, during RGB processing) and a shading correction parameter forthe lens 832.

An image processing method is implemented by use of the image processingtechnology in FIG. 24 through the following operations at blocks S12 toS16.

At block S12, each frame of image in multiple continuous frames ofimages is processed to determine the number of light sources of eachframe of image.

At block S14, it is determined whether a difference between the numberof the light sources of a kth frame of image and the number of the lightsources of a (k+1)th frame of image is equal to 0.

At block S16, responsive to determining that the difference is unequalto 0, a color temperature of the (k+1)th frame of image is determined tobe a color temperature of the kth frame of image and the (k+1)th frameof image is processed according to the color temperature of the (k+1)thframe of image.

Those of ordinary skill in the art should understand that all or part ofthe flows in the method of the abovementioned embodiments may becompleted through related hardware instructed by a computer program, andthe program may be stored in a nonvolatile computer-readable storagemedium. When the program is executed, the flows of each methodembodiment may be included. The storage medium may be a magnetic disk,an optical disk, a Read-Only Memory (ROM) and the like.

The abovementioned embodiments only describe some implementation modesof the disclosure and are specifically described in detail, but itshould not be understood as limits to the scope of the disclosure. Itshould be pointed out that those of ordinary skill in the art mayfurther make a plurality of transformations and improvements withoutdeparting from the concept of the disclosure and all of these shall fallwithin the scope of protection of the disclosure. Therefore, the scopeof patent protection of the disclosure should be subject to the appendedclaims.

1. An image processing method, comprising: processing each frame ofimage in multiple continuous frames of images to determine a number oflight sources of each frame of image; determining whether a differencebetween a number of light sources of a kth frame of image and a numberof light sources of a (k+1)th frame of image is equal to 0; andresponsive to determining that the difference is unequal to 0,determining a color temperature of the (k+1)th frame of image to be acolor temperature of the kth frame of image, and processing the (k+1)thframe of image according to the color temperature of the (k+1)th frameof image.
 2. The image processing method of claim 1, wherein theoperation of processing each frame of image in the multiple continuousframes of images to determine the number of the light sources of eachframe of image comprises: dividing a preview image into multipleregions; for each of the multiple regions, determining whether theregion is a target region comprising a light source according to ahistogram of the region; responsive to determining that the region isthe target region comprising light sources, determining whether thereare multiple target regions adjacent to the region; responsive todetermining that there are multiple target regions adjacent to theregion, splicing the multiple target regions into a light source;responsive to determining that there are no target regions adjacent tothe region, determining the target region as a light source; andcounting the light sources.
 3. The image processing method of claim 1,wherein the operation of processing each frame of image in the multiplecontinuous frames of images to determine the number of the light sourcesof each frame of image further comprises: determining a high-luminanceregion and a medium-luminance region according to a luminancedistribution extending outwards from a center of a light source along aradial direction of the light source; and determining a color of thelight source by subtracting pixel averages of primary color channels ofthe medium-luminance region from pixel averages of primary colorchannels of the high-luminance region.
 4. The image processing method ofclaim 3, wherein the operation of determining, responsive to determiningthat the difference value is unequal to 0, the color temperature of the(k+1)th frame of image to be the color temperature of the kth frame ofimage and processing the (k+1)th frame of image according to the colortemperature of the (k+1)th frame of image comprises: determining whetherthe number of the light sources of the kth frame of image is more thanor equal to 1; responsive to determining that the number of the lightsources of the kth frame of image is less than 1, adopting a gray worldmethod to perform white balance processing on the kth frame of image andthe (k+1)th frame of image; responsive to determining that the number ofthe light sources of the kth frame of image is equal to 1, determiningthe color temperature and number of the light sources of the (k+1)thframe of image according to the color temperature and number of thelight sources of the kth frame of image and performing white balanceprocessing on the (k+1)th frame of image according to the colortemperature of the (k+1)th frame of image; and responsive to determiningthat the number of the light sources of the kth frame of image is morethan 1, determining a primary light source according to at least one ofscenario parameters, areas or luminance parameters of the light sourcesof the kth frame of image, determining the color temperature of the(k+1)th frame of image according to a color temperature of the primarylight source, performing white balance processing on the (k+1)th frameof image according to the color temperature of the (k+1)th frame ofimage, and determining the number of the light sources of the (k+1)thframe of image to be the number of the light sources of the kth frame ofimage, wherein the scenario parameters comprise image shooting time andsignal strength of a Global Positioning System (GPS), and the luminanceparameters comprise luminance of multiple light sources.
 5. The imageprocessing method of claim 3, further comprising: responsive todetermining that the difference is equal to 0, performing white balanceprocessing on an mth frame of image according to a color temperature ofthe mth frame of image, the mth frame of image comprising the kth frameof image or the (k+1)th frame of image.
 6. The image processing methodof claim 5, wherein the operation of performing, responsive todetermining that the difference value is equal to 0, white balanceprocessing on the mth frame of image according to the color temperatureof the mth frame of image, the mth frame of image comprising the kthframe of image or the (k+1)th frame of image, comprises: determiningwhether the number of the light sources is more than or equal to 1;responsive to determining that the number of the light sources is lessthan 1, adopting a gray world method to perform white balance processingon the mth frame of image; responsive to determining that the number ofthe light sources is equal to 1, performing white balance processing onthe mth frame of image according to a color temperature of the lightsource; and responsive to determining that the number of the lightsources is more than 1, determining a primary light source according toat least one of scenario parameters, areas or luminance parameters ofthe light sources and performing white balance processing on the mthframe of image according to a color temperature of the primary lightsource, wherein the scenario parameters comprise image shooting time andsignal strength of a GPS, and the luminance parameters compriseluminance of multiple light sources.
 7. An image processing device,comprising: a first processing module, configured to process each frameof image in multiple continuous frames of images to determine a numberof light sources of each frame of image; a judgment module, configuredto determine whether a difference between a number of light sources of akth frame of image and a number of light sources of a (k+1)th frame ofimage is equal to 0; and a second processing module, configured to,responsive to determining that the difference is unequal to 0, determinea color temperature of the (k+1)th frame of image to be a colortemperature of the kth frame of image and process the (k+1)th frame ofimage according to the color temperature of the (k+1)th frame of image.8. The image processing device of claim 7, wherein the first processingmodule comprises: a division unit, configured to divide a preview imageinto multiple regions; a first judgment unit, configured to, for each ofthe multiple regions, determine whether the region is a target regioncomprising a light source according to a histogram of the region; asecond judgment unit, configured to, responsive to determining that theregion is the target region comprising light sources, determine whetherthere are multiple target regions adjacent to the region; a splicingunit, configured to, responsive to determining that there are multipletarget regions adjacent to the region, splice the multiple targetregions into a light source; a first determination unit, configured to,responsive to determining that there are no adjacent target regionsadjacent to the region, determine the target regions as a light source;and a counting unit, configured to count the light sources.
 9. The imageprocessing device of claim 7, wherein the first processing modulecomprises: a second determination unit, configured to determine ahigh-luminance region and a medium-luminance region according to aluminance distribution extending outwards from a center of a lightsource along a radial direction of the light source; and a thirddetermination unit, configured to determine a color of the light sourceby subtracting pixel averages of primary color channels of themedium-luminance region from pixel averages of primary color channels ofthe high-luminance region.
 10. The image processing device of claim 9,wherein the second processing module comprises: a third judgment unit,configured to determine whether the number of the light sources of thekth frame of image is more than or equal to 1; a first processing unit,configured to, responsive to determining that the number of the lightsources of the kth frame of image is less than 1, adopt a gray worldmethod to perform white balance processing on the kth frame of image andthe (k+1)th frame of image; a second processing unit, configured to,responsive to determining that the number of the light sources of thekth frame of image is equal to 1, determine the color temperature andnumber of the light sources of the (k+1)th frame of image according tothe color temperature and number of the light sources of the kth frameof image, and perform white balance processing on the (k+1)th frame ofimage according to the color temperature of the (k+1)th frame of image;and a third processing unit, configured to, responsive to determiningthat the number of the light sources of the kth frame of image is morethan 1, determine a primary light source according to at least one ofscenario parameters, areas or luminance parameters of the light sourcesof the kth frame of image, determine the color temperature of the(k+1)th frame of image according to a color temperature of the primarylight source, perform white balance processing on the (k+1)th frame ofimage according to the color temperature of the (k+1)th frame of image,and determine the number of the light sources of the (k+1)th frame ofimage to be the number of the light sources of the kth frame of image,wherein the scenario parameters comprise image shooting time and signalstrength of a Global Positioning System (GPS), and the luminanceparameters comprise luminance of multiple light sources.
 11. The imageprocessing device of claim 9, further comprising: a third processingmodule, configured to, responsive to determining that the difference isequal to 0, perform white balance processing on an mth frame of imageaccording to a color temperature of the mth frame of image, wherein themth frame of image comprises the kth frame of image or the (k+1)th frameof image.
 12. The image processing device of claim 11, wherein the thirdprocessing module comprises: a fourth judgment unit, configured todetermine whether the number of the light sources is more than or equalto 1 or not; a fourth processing unit, configured to, responsive todetermining that the number of the light sources is less than 1, adopt agray world method to perform white balance processing on the mth frameimage; a fifth processing unit, configured to, responsive to determiningthat the number of the light sources is equal to 1, perform whitebalance processing on the mth frame image according to a colortemperature of the light source; and a sixth processing unit, configuredto, responsive to determining that the number of the light sources ismore than 1, determine a primary light source according to at least oneof scenario parameters, areas or luminance parameters of the lightsources and perform white balance processing on the mth frame imageaccording to a color temperature of the primary light source, whereinthe scenario parameters comprise image shooting time and signal strengthof a GPS, and the luminance parameters comprise luminance of multiplelight sources.
 13. A non-transitory computer-readable storage medium,comprising one or more computer-executable instructions that, whenexecuted by one or more processors, cause the one or more processors toexecute an image processing method, the method comprising: processingeach frame of image in multiple continuous frames of images to determinea number of light sources of each frame of image; determining whether adifference between a number of light sources of a kth frame of image anda number of light sources of a (k+1)th frame of image is equal to 0; andresponsive to determining that the difference is unequal to 0,determining a color temperature of the (k+1)th frame of image to be acolor temperature of the kth frame of image, and processing the (k+1)thframe of image according to the color temperature of the (k+1)th frameof image.
 14. The non-transitory computer-readable storage medium ofclaim 13, wherein the operation of processing each frame of image in themultiple continuous frames of images to determine the number of thelight sources of each frame of image comprises: dividing a preview imageinto multiple regions; for each of the multiple regions, determiningwhether the region is a target region comprising a light sourceaccording to a histogram of the region; responsive to determining thatthe region is the target region comprising light sources, determiningwhether there are multiple target regions adjacent to the region;responsive to determining that there are multiple target regionsadjacent to the region, splicing the multiple target regions into alight source; responsive to determining that there are no target regionsadjacent to the region, determining the target region as a light source;and counting the light sources.
 15. A computer device, comprising: amemory and a processor, the memory storing a computer-executableinstruction that, when executed by the processor, causes the processorto execute an image processing method, the method comprising: processingeach frame of image in multiple continuous frames of images to determinea number of light sources of each frame of image; determining whether adifference between a number of light sources of a kth frame of image anda number of light sources of a (k+1)th frame of image is equal to 0; andresponsive to determining that the difference is unequal to 0,determining a color temperature of the (k+1)th frame of image to be acolor temperature of the kth frame of image, and processing the (k+1)thframe of image according to the color temperature of the (k+1)th frameof image.
 16. The computer device of claim 15, wherein the operation ofprocessing each frame of image in the multiple continuous frames ofimages to determine the number of the light sources of each frame ofimage comprises: dividing a preview image into multiple regions; foreach of the multiple regions, determining whether the region is a targetregion comprising a light source according to a histogram of the region;responsive to determining that the region is the target regioncomprising light sources, determining whether there are multiple targetregions adjacent to the region; responsive to determining that there aremultiple target regions adjacent to the region, splicing the multipletarget regions into a light source; responsive to determining that thereare no target regions adjacent to the region, determining the targetregion as a light source; and counting the light sources.
 17. Thecomputer device of claim 15, wherein the operation of processing eachframe of image in the multiple continuous frames of images to determinethe number of the light sources of each frame of image furthercomprises: determining a high-luminance region and a medium-luminanceregion according to a luminance distribution extending outwards from acenter of a light source along a radial direction of the light source;and determining a color of the light source by subtracting pixelaverages of primary color channels of the medium-luminance region frompixel averages of primary color channels of the high-luminance region.18. The computer device of claim 17, wherein the operation ofdetermining, responsive to determining that the difference value isunequal to 0, the color temperature of the (k+1)th frame of image to bethe color temperature of the kth frame of image and processing the(k+1)th frame of image according to the color temperature of the (k+1)thframe of image comprises: determining whether the number of the lightsources of the kth frame of image is more than or equal to 1; responsiveto determining that the number of the light sources of the kth frame ofimage is less than 1, adopting a gray world method to perform whitebalance processing on the kth frame of image and the (k+1)th frame ofimage; responsive to determining that the number of the light sources ofthe kth frame of image is equal to 1, determining the color temperatureand number of the light sources of the (k+1)th frame of image accordingto the color temperature and number of the light sources of the kthframe of image and performing white balance processing on the (k+1)thframe of image according to the color temperature of the (k+1)th frameof image; and responsive to determining that the number of the lightsources of the kth frame of image is more than 1, determining a primarylight source according to at least one of scenario parameters, areas orluminance parameters of the light sources of the kth frame of image,determining the color temperature of the (k+1)th frame of imageaccording to a color temperature of the primary light source, performingwhite balance processing on the (k+1)th frame of image according to thecolor temperature of the (k+1)th frame of image, and determining thenumber of the light sources of the (k+1)th frame of image to be thenumber of the light sources of the kth frame of image, wherein thescenario parameters comprise image shooting time and signal strength ofa Global Positioning System (GPS), and the luminance parameters compriseluminance of multiple light sources.
 19. The computer device of claim17, wherein the operations further comprise: responsive to determiningthat the difference is equal to 0, performing white balance processingon an mth frame of image according to a color temperature of the mthframe of image, the mth frame of image comprising the kth frame of imageor the (k+1)th frame of image.
 20. The computer device of claim 19,wherein the operation of performing, responsive to determining that thedifference value is equal to 0, white balance processing on the mthframe of image according to the color temperature of the mth frame ofimage, the mth frame of image comprising the kth frame of image or the(k+1)th frame of image, comprises: determining whether the number of thelight sources is more than or equal to 1; responsive to determining thatthe number of the light sources is less than 1, adopting a gray worldmethod to perform white balance processing on the mth frame of image;responsive to determining that the number of the light sources is equalto 1, performing white balance processing on the mth frame of imageaccording to a color temperature of the light source; and responsive todetermining that the number of the light sources is more than 1,determining a primary light source according to at least one of scenarioparameters, areas or luminance parameters of the light sources andperforming white balance processing on the mth frame of image accordingto a color temperature of the primary light source, wherein the scenarioparameters comprise image shooting time and signal strength of a GPS,and the luminance parameters comprise luminance of multiple lightsources.